<?php namespace App\Controllers\Manager;

//http://www.codeforest.net/laravel4-simple-website-with-backend-1
 
use App\Models\ProductFileType;
use Input, Redirect, Sentry, Str;
use Notification;
 
class ProductFileTypesController extends \BaseController {
 
    public function index()
    {
        return \View::make('manager.productfiletypes.index')
           ->with('productfiletypes', ProductFileType::all());
    }
 
    public function show($id)
    {
        return \View::make('manager.productfiletypes.show')
            ->with('productfiletype', ProductFileType::find($id));
    }
 
    public function create()
    {
        return \View::make('manager.productfiletypes.create');
    }
 
    public function store()
    {
        $productfiletype = new ProductFileType;
        $productfiletype->type   = Input::get('type');
        $productfiletype->save();

        Notification::success('The product file type was saved.');
     
        return Redirect::route('manager.productfiletypes.index');
    }
 
    public function edit($id)
    {
        return \View::make('manager.productfiletypes.edit')
            ->with('productfiletype', ProductFileType::find($id));
    }
 
    public function update($id)
    {
        $productfiletype = ProductFileType::find($id);
        $productfiletype->type   = Input::get('type');
        $productfiletype->save();

        Notification::success('The product file type was saved.');
     
        return Redirect::route('manager.productfiletypes.edit', $productfiletype->id);
    }
 
    public function destroy($id)
    {
        $productfiletype = ProductFileType::find($id);
        $productfiletype->delete();

        Notification::info('The product file type was deleted.');

        return Redirect::route('manager.productfiletypes.index');
    }
}